package cn.tt.tuantuanerp.tuantuanerp.product.webapi.service.impl;


import cn.tt.tuantuanerp.tuantuanerp.comment.ex.ServiceException;
import cn.tt.tuantuanerp.tuantuanerp.comment.pojo.vo.SkuLogStandardVO;
import cn.tt.tuantuanerp.tuantuanerp.comment.security.LoginPrincipal;
import cn.tt.tuantuanerp.tuantuanerp.comment.web.ServiceCode;
import cn.tt.tuantuanerp.tuantuanerp.product.service.ISkuLogService;
import cn.tt.tuantuanerp.tuantuanerp.product.webapi.mapper.SkuLogMapper;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class SkuLogServiceImpl implements ISkuLogService {

    @Autowired
    SkuLogMapper skuLogMapper;

    @Override
    public List<SkuLogStandardVO> list(Long id, Integer pageIndex, Integer pageSize,LoginPrincipal loginPrincipal){
        log.debug("开始处理查询SkuLog列表业务,操作人为:{}",loginPrincipal.getUsername());
        PageHelper.startPage(pageIndex,pageSize);
        List<SkuLogStandardVO> skuLogStandardVO = skuLogMapper.selectBySkuId(id);
        if (skuLogStandardVO==null){
            throw new ServiceException(ServiceCode.ERR_NOT_FOUND,"该sku不存在!");
        }
        return skuLogStandardVO;
    }

}
